{% extends "base.html" %}
{% load djblets_deco %}
{% load i18n %}
{% block title %}{% trans "New Review Request" %}{% endblock %}

{% block css %}
<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}rb/css/diffviewer.css?{{MEDIA_SERIAL}}" />
<link rel="stylesheet" type="text/css" href="{{MEDIA_URL}}rb/css/reviews.css?{{MEDIA_SERIAL}}" />
{% endblock %}

{% block scripts-post %}
<script type="text/javascript">
    var visible = {{fields|safe}};

    function updateFormDisplay() {
        var selection = $("#id_repository").get(0);
        var selectedID = selection.options[selection.selectedIndex].value;

        $("tr[class^=row_]").hide();
        $(visible[selectedID]).each(function() {
            $("tr.row_" + this).show();
        });
    }

    $(document).ready(function() {
        $("#id_repository")
            .change(updateFormDisplay)
            .triggerHandler("change");
    });
</script>
{% endblock %}

{% block content %}
{% box "tip" %}
<h1>{% trans "Tip: Use post-review" %}</h1>
<p>
{% blocktrans %}
 You can simplify creating and updating review requests by using
 <a href="http://www.reviewboard.org/docs/manual/dev/users/tools/post-review/">post-review</a>.
{% endblocktrans %}
</p>
<p>
{% blocktrans %}
 post-review is a command line tool that will help create compatible diffs,
 create new review requests, and update them, effortlessly. It is compatible
 with Windows, Linux, MacOS X, and other unix-like operating systems.
{% endblocktrans %}
</p>
{% endbox %}

<form method="post" action="." enctype="multipart/form-data">
{% box "new-review-request" %}
 <h1 class="title">{% trans "New Review Request" %}</h1>
 <div class="main">
  <table>
   <tr>
    <td><label for="id_repository">{% trans "Repository" %}:</label></td>
	<td>{{form.repository}}</td>
	<td>{{form.repository.errors}}</td>
   </tr>
   <tr class="row_no_repository_explanation">
    <td></td>
    <td class="help" colspan="2">
     {% blocktrans %}
     You won't be able to add any diffs to this review request. The review
     request will only be usable for reviewing screenshots and other graphic
     files.
     {% endblocktrans %}
    </td>
   </tr>
   <tr class="row_changenum">
    <td><label for="id_changenum">{{form.changenum.label}}:</label></td>
    <td>{{form.changenum}}</td>
    <td>{{form.changenum.errors}}</td>
   </tr>
   <tr class="row_basedir">
    <td><label for="id_basedir">{{form.basedir.label}}:</label></td>
    <td>{{form.basedir}}</td>
    <td>{{form.basedir.errors}}</td>
   </tr>
   <tr class="row_basedir">
    <td></td>
    <td class="help" colspan="2">{{form.basedir.help_text}}</td>
   </tr>
   <tr class="row_diff_path">
    <td><label for="id_diff_path">{{form.diff_path.label}}:</label></td>
    <td>{{form.diff_path}}</td>
    <td>{{form.diff_path.errors}}</td>
   </tr>
   <tr class="row_diff_path">
    <td></td>
    <td class="help" colspan="2">{{form.diff_path.help_text}}</td>
   </tr>
   <tr class="row_parent_diff_path">
    <td><label for="id_parent_diff_path">{{form.parent_diff_path.label}}:</label></td>
    <td>{{form.parent_diff_path}}</td>
    <td>{{form.parent_diff_path.errors}}</td>
   </tr>
   <tr class="row_parent_diff_path">
    <td></td>
    <td class="help" colspan="2">{{form.parent_diff_path.help_text}}</td>
   </tr>
  </table>
 </div>
{% endbox %}
 <div class="prefsbuttons">
  <input type="submit" value="{% trans "Create Review Request" %}" />
 </div>
</form>

{% endblock %}

